From 543b6e24b06f67b472557373112ab368c7abd233 Mon Sep 17 00:00:00 2001 From: "ack@localhost.localdomain" Date: Tue, 15 Aug 2006 11:13:04 +0100 Subject: [PATCH] Adjust truesize in netfront to more closely reflect real data payload plus supervisor overheads but keeping out gross hypervisor overheads. Signed-off-by: Emmanuel Ackaouy --- .../drivers/xen/netfront/netfront.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 26745de79a..d1c324db2b 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -1199,7 +1199,28 @@ err: } i = xennet_fill_frags(np, skb, &tmpq); - skb->truesize += skb->data_len; + + /* + * Truesize must approximates the size of true data plus + * any supervisor overheads. Adding hypervisor overheads + * has been shown to significantly reduce achievable + * bandwidth with the default receive buffer size. It is + * therefore not wise to account for it here. + * + * After alloc_skb(RX_COPY_THRESHOLD), truesize is set to + * RX_COPY_THRESHOLD + the supervisor overheads. Here, we + * add the size of the data pulled in xennet_fill_frags(). + * + * We also adjust for any unused space in the main data + * area by subtracting (RX_COPY_THRESHOLD - len). This is + * especially important with drivers which split incoming + * packets into header and data, using only 66 bytes of + * the main data area (see the e1000 driver for example.) + * On such systems, without this last adjustement, our + * achievable receive throughout using the standard receive + * buffer size was cut by 25%(!!!). + */ + skb->truesize += skb->data_len - (RX_COPY_THRESHOLD - len); skb->len += skb->data_len; /* -- 2.30.2